﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Driver;
using System.Web.Configuration;

namespace GU.WebERP.Core.Utils
{
    public static class MongoDBHelper
    {
        private static MongoDatabase _dbEbsLog;

        public static MongoDatabase DbEbsLog
        {
            get
            {
                if (_dbEbsLog == null)
                {
                    
                    string connection = WebConfigurationManager.AppSettings["MongoDB.Log.Connection"];
                    string databaseName = WebConfigurationManager.AppSettings["MongoDB.Log.Database"];
                    var server = MongoServer.Create(connection);
                    _dbEbsLog = server.GetDatabase(databaseName);
                }
                return _dbEbsLog;
            }
        }
    }
}
